{extend name="platform/base" /}
 {block name="main"}
<link rel="stylesheet" type="text/css" href="PLATFORM_CSS/set.css">
<style>
input{
	width: 150px;
    height: 30px;
    padding: 5px;
}
.share dl {
    overflow: hidden;
    padding: 0;
}
dl{
	margin-bottom:0;
}
.edit_button{
	font-family: "microsoft yahei";
    border-radius: 4px;
    padding: 8px 30px;
    background-color: #51A351;
    color: #FFF;
    margin: 20px auto;
    border: none;
   
}
    

</style>
<script>
  
</script>
<section class="panel panel-default">
	<header class="panel-heading font-bold"> <span class="text">绑定开发者账号</span><span class="muted">（选填，用于配置自定义菜单）</span></header>
	<div class="panel-body">
		<div class="container-fluid">
				<div class="main share" style="position: inherit;overflow-y: visible;">
				    
				    <div class="binding">
						<div class="input-prepend control-group" style="margin-bottom: 15px;">
							<span class="add-on"><i class="icon-user"></i></span> <input
								class="span2" id="appid" placeholder="appID"
								value="{$wchat_config.appid}" type="text"><span
								class="help-inline"></span>
						</div>
						<div class="mt8"></div>
						<div class="input-prepend control-group">
							<span class="add-on"><i class="icon-lock"></i></span> <input
								class="span2" id="appsecret" type="text" placeholder="Appsecret"
								value="{$wchat_config.appsecret}"><span class="help-inline"></span>
						</div>
						<p class="muted mt8" style="margin-top:5px;">
							AppID以及Appsecret来自于您申请开发接口时提供的账号和密码。
							<!--<a class="ahelp"
									href="/admin.php/UserManage/WeiXinHelp02?HeadCode=10000&amp;MenuCode=10060">
					 				<i 
									class="icon-help-blue" 
					 				style="background: url(/public/admin/images/bluequestion.png) no-repeat -6px -8px;"></i> 
									详细绑定步骤</a>-->
						</p>
					</div>
				    
				    <div class="smallTitle mt30" style="font-size: 14px;color: #333;margin-top:10px;">
						<span class="text">服务器配置</span><span class="muted">（用于接收用户消息）</span>
					</div>
					
					<div class="serve">
						<dl>
							<dt style="width:100%;">URL:</dt>
							<dd style="width:100%;">
								<input class="text" style="background-color: white; border: none;min-width: 400px;display: inline-block;color:#777;"
									readonly="readonly" id="empowerUrl" value="{$call_back_url}">
								<button onclick="JScopy('empowerUrl')" type="button" class="btn">复制</button>
							</dd><br/>
							<dt style="width:100%;">Token:</dt>
							<dd style="width:100%;">
								<input class="text" style="background-color: white; border: none;min-width: 400px;display: inline-block;color:#777;"
									id="empowerToken" readonly="readonly" value="TOKEN">
								<button onclick="JScopy('empowerToken')" type="button" class="btn">复制</button>
							</dd>
						</dl>
						<p class="muted">
							请将以上URL及Token填到微信公众平台中，以完成绑定。
							<!-- 		<a class="ahelp"
									href="/admin.php/UserManage/WeiXinHelp01?HeadCode=10000&amp;MenuCode=10060"
									>
							<i class="icon-help-blue" style="background: url(/public/admin/images/bluequestion.png) no-repeat -6px -3px;"></i> 
									
									详细绑定步骤</a>-->
						</p>
					</div>
					<div class="smallTitle mt30" style="line-heigth:30px;padding:15px 0;">
						<span class="text">设置业务域名</span><span class="muted">（设置业务域名，用户在相应域名上进行输入时不再出现防欺诈盗号等安全提示）</span>
					</div>
					
					<div class="setdomain">
						<p class="titlestep" style="padding: 10px 0;">
							<a href="https://mp.weixin.qq.com/" target="_blank">登录微信公众平台</a>点击公众号设置&gt;功能设置&gt;业务域名设置，一次填写：
						</p>
						<p class="text-success" style="padding: 10px 0;">
							<span class="muted">域名1：</span>{$url}
						</p>
						<p class="titlestep mt30" style="padding: 10px 0;">
							<a href="https://mp.weixin.qq.com/" target="_blank">登录微信公众平台</a>点击公众号设置&gt;开发者中心&gt;网页授权获取用户基本信息&gt;修改：
						</p>
						<p class="text-success" style="padding: 10px 0;">
							<span class="muted">填写授权回调页面域名：</span>{$url}
						</p>
						<p>业务域名设置完毕！</p>
					</div>
					<p class="button mt20" style="display:block;">
						<button class="edit_button" onclick="save()">保存</button>
						<input type="hidden" id="IsChange" value="true">
					</p>
				</div>
			</div>	
		</div>
<script>
function save() {
	var appid = $("#appid").val();
	var appsecret = $("#appsecret").val();
	$.ajax({
		type : "post",
		url : "ADMIN_MAIN/wchat/setinstancewchatconfig",
		data : {
			"appid" : appid,
			"appsecret" : appsecret
		},
		success : function(res) {
			if (res.code > 0) {
				showMessage('success', res["message"]);
			} else {
				showMessage('error', res["message"]);
			}
		}

	});
}
function JScopy(obj){
	var url = document.getElementById(obj);
	url.select();
	document.execCommand("Copy");
}
</script>
</section>
{/block}
